﻿// -------------------------------------------------------------------------
//    @FileName         :    NFRegisterCache.h
//    @Author           :    gaoyi
//    @Date             :    24-8-15
//    @Email            :    445267987@qq.com
//    @Module           :    NFRegisterCache
//
// -------------------------------------------------------------------------

#pragma once

#include <NFServerComm/NFServerCommon/NFDBGlobalTemplate.h>

#include "proto_common_role.nanopb.h"
#include "proto_db.pb.h"
#include "NFComm/NFObjCommon/NFObject.h"
#include "NFLogicCommon/NFLogicShmTypeDefines.h"

class NFRegisterCache : public NFDBGlobalTemplate<NFRegisterCache, proto_ff::tbMiscData, EOT_LOGIC_REGISTER_CACHE_ID>
{
public:
    NFRegisterCache();

    virtual ~NFRegisterCache();

    int CreateInit();

    int ResumeInit();
public:
    int AfterAllConnectAndAllDescStore(NF_SERVER_TYPE serverType) override;
public:
    int AddQQRegisteNum();

    int GetQQRegisteNum() { return m_stData.qq_registe_num; }

    int AddWXRegisteNum();

    int GetWXRegisteNum() { return m_stData.wx_registe_num; }

    bool CheckRegNumFull();

    int AddPreRegistNum();

    int DelPreRegistNum();

    int GetPreRegistNum() { return m_iPreRegistNum; }

public:
    virtual int LoadFromDB(const proto_ff::tbMiscData& dbData);

    virtual int SaveToDB(proto_ff::tbMiscData& dbData);

    virtual int InitConfig();

    virtual int GetDbId();
private:
    AccountRegisteInfo m_stData;
    int32_t m_iPreRegistNum;
};
